package net.optix.ip.commands
{
	import com.adobe.cairngorm.business.Responder;
	import com.adobe.cairngorm.commands.Command;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import net.optix.ip.business.*;
	import net.optix.ip.events.GetAuctionEvent;
	import net.optix.ip.events.InviteeFirmEvent;
	import net.optix.ip.model.ModelLocator;
	import net.optix.ip.vo.AuctionVO;
	import mx.controls.Alert;
	
	public class InviteeFirmCommand implements Command, Responder
	{
		// attributes ============================
		private var model : ModelLocator = ModelLocator.getInstance();


		// functions ============================
		public function execute( event:CairngormEvent ) : void
		{
			var myEvent:InviteeFirmEvent = InviteeFirmEvent( event );
			
			var delegate:InventinDelegate = new InventinDelegate(  );     
			delegate.inviteeFirm( this , myEvent.email, myEvent.message );
			
		}
		
		//----------------------------------------------------------------------------
		public function onResult( event : * = null ) : void
		{
			trace(event.result);
			var result:int	;
			try
			{
				result	=	event.result.result;
			}
			catch(error:Error){}
			
			switch(result)
			{
				case -2:
					model.result	=	"Access Denied .";
					break;
				case 1:
					model.result	=	"Successfully send invitee !";
					break;
				case 0:
					model.result	=	"Program error !";
					break;
			}
		}
		
		//----------------------------------------------------------------------------
		public function onFault( event : * = null ) : void
		{
			model.result	=	"Program error";	
		}

	}
}